<?php
session_start();
?>
<html>

<head>
<?php $a[0] = "active"; ?>
<?php
include ('head.php');

?>
 <script>
function loadXMLDoc()
{
	
	if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("pro5").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ss1.php",true);

xmlhttp.send();
}
	function loadXMLDoc2()
{
	
	if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("pro5").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ss2.php",true);

xmlhttp.send();
}
function loadXMLDocSP()
{
	
	if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("pro5").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","SPSS.php",true);

xmlhttp.send();
}
</script>

</head>
<body>

<?php
include ('dbcon.php');
include ('webtitle.php');
include ('topbannermenu.php');
include ('leftmenu.php');
include ('rightmenu.php');
?>	

    
 <div id = "divMid">
        <div id = "pro4">
        <?php
$ok=1;
if(isset($_SESSION['SS']))
{
 foreach($_SESSION['SS'] as $k1 => $v1)
 {
  if(isset($k1))
  {
   $ok=2;
  }
 }
}
if($ok == 2)
{

  
   foreach($_SESSION['SS'] as $key1=>$value1)
   {
    $item1[]=$key1;
   }
   $str1=implode(",",$item1);
   $query=mysql_query("select * from sanpham where MaSP in ($str1)");
   ?>
   <table class="show" border="0" align="center" >
        <tr align="center">
        <td width = "25%">
        <h3><center>
          <p>&nbsp;</p>
        <?php
		
		if(count($_SESSION['SS']) == 1)
		{  
          echo '<button type = "button" onclick="loadXMLDoc()" class = "css"> So Sánh </button><br />';
         echo " <p>&nbsp;</p>
		<br>
		<button type = 'button' onclick='loadXMLDocSP()' class = 'css' >Chọn Điện Thoại </button><br />
		<p>&nbsp;</p><br>
		<a href='delss.php?madt=0'><button type = 'button' class = 'css'> Xóa Tất Cả </button></a><p>&nbsp;</p><br />
		
        </center></h3>
        </td>";
		
   while($row1=mysql_fetch_array($query))
   {
	   
	   	   echo" <td  class='show3'>";
	   $id1  = $row1[0];
   echo "<font color='#000' size='2px'><label><strong><u><p><a href='detail.php?madt=$row1[0]'> $row1[1] </strong></label></a></p></u></font>";?>
	      
		  <p><br/>
	      <?php echo "<img  src ='$row1[4]' width ='70' height ='95' class = 'gia'>"?></p>
		  <table border="0" width ="97%" >
            <tr><td >
		<p> <?php  echo "<a href='delss.php?madt=$row1[0]'>"; ?><img src="index/-.png"  class = 'btss'></a> </p>
            
           <br/>
            </td>
            </tr>
			</table>
		    <font color="#FF0000" size="2px"><label ><strong><?php echo "". number_format($row1[3],0) ."đ";?>
	        </strong></label></font>
		
         
  <?php
   }
   ?>
    <td  class="show3">
	   
   
	      
		  <p><br/>
	      <a onClick="loadXMLDocSP()"><img src ='./index/SS.jpg' height = '125px' width = '100%'></a></p>
		 
		 </td>
           
  </tr>
  </table>
 <?php  
		}
		if(count($_SESSION['SS']) == 2)
		{
			echo '<button type = "button" onclick="loadXMLDoc2()" class = "css" >So Sánh</button><br />';
			 echo " <p>&nbsp;</p>
			 <br>
		<button type = 'button' onclick='loadXMLDocSP()' class = 'css' >Chọn Điện Thoại </button><br />
		<p>&nbsp;</p><br>
		<a href='delss.php?madt=0'><button type = 'button' class = 'css'  > Xóa Tất Cả </button></a><p>&nbsp;</p><br />
        </center></h3>
        </td>";
			 while($row1=mysql_fetch_array($query))
   {
	   echo" <td  class='show3' >";
	   $id1  = $row1[0];
   echo "<font color='#000' size='2px'><label><strong><u><p><a href='detail.php?madt=$row1[0]'> $row1[1] </strong></label></a></p></u></font>";?>
	      
		  <p><br/>
	      <?php echo "<img  class ='gia' src ='$row1[4]' width ='70px' height ='95px'>"?></p>
		  
           <table border="0" width ="97%" >
            <tr><td >
		<p> <?php  echo "<a href='delss.php?madt=$row1[0]'>"; ?><img src="index/-.png"  class = 'btss'></a> </p>
            
           <br/>
            </td>
            </tr>
			</table>
		    <font color="#FF0000" size="3px"><label><strong><?php echo "". number_format($row1[3],0) ."đ";?>
	        </strong></label></font>
            
        
		 </td>
           
   
  		<?php
   
   		 
		}
		echo" </tr>";
  echo "</table>";
		}
	
}
else
{?>
	<table class="show3" border="0" align="center" >
        <tr align="center">
        <td width = "30%">
        <h3><center>
          <p>&nbsp;</p>
	<?php
			echo '<button type = "button" onclick="loadXMLDoc()"> So Sánh </button><br />';
         echo " <p>&nbsp;</p>
		<br>
		<button type = 'button' onclick='loadXMLDocSP()'>Chọn Điện Thoại </button><br />
        </center></h3>
        </td>";

		?>
        <td  class='show3'>
        <p><br/>
	      <a onClick="loadXMLDocSP()"><img src ='./index/SS.jpg' height = '125px' width = '100%'></a></p>
		 
		 </td>
	</td>
    <td  class="show3">	      
		  <p><br/>
	      <a onClick="loadXMLDocSP()"><img src ='./index/SS.jpg' height = '125px' width = '100%'></a></p>
		 
		 </td>
           
  </tr>
  </table>	
<?php } ?>		
<div id ="pro5" class ="pro5">

</div>
</div>
</div>
		<div class="clr"></div>
		<?php 
		include ('footer.php');
		?>
</div>
</body>
</html>